<template>
  <div class="error-container">
    <div class="error-content">
      <div class="error-code">404</div>
      <h1 class="error-title">页面未找到</h1>
      <p class="error-message">
        抱歉，您访问的页面不存在或已被移除。
        <br>请检查您输入的网址是否正确，或返回首页继续浏览。
      </p>
      <div class="error-actions">
        <router-link to="/home" class="btn-primary">返回首页</router-link>
        <button @click="goBack" class="btn-secondary">返回上一页</button>
      </div>
    </div>
    <div class="error-footer">
      <p>© 2023 Your Project Name. All rights reserved.</p>
    </div>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router';

const router = useRouter();

const goBack = () => {
  router.go(-1);
};
</script>

<style scoped lang="scss">
.error-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #f5f7fa;
  padding: 20px;
}

.error-content {
  text-align: center;
  max-width: 600px;
  width: 100%;
}

.error-code {
  font-size: 12rem;
  font-weight: 700;
  background: linear-gradient(135deg, #409eff, #67c23a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
  margin-bottom: 20px;
  position: relative;
  animation: float 3s ease-in-out infinite;
}

.error-title {
  font-size: 2rem;
  color: #303133;
  margin-bottom: 16px;
}

.error-message {
  font-size: 1rem;
  color: #606266;
  line-height: 1.6;
  margin-bottom: 30px;
}

.error-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 40px;
}

.btn-primary {
  padding: 12px 24px;
  background-color: #409eff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s;
  text-decoration: none;
}

.btn-primary:hover {
  background-color: #337ecc;
}

.btn-secondary {
  padding: 12px 24px;
  background-color: white;
  color: #606266;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.3s;
}

.btn-secondary:hover {
  background-color: #f5f7fa;
  border-color: #c0c4cc;
}

.error-footer {
  position: absolute;
  bottom: 20px;
  color: #909399;
  font-size: 0.875rem;
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
  100% { transform: translateY(0px); }
}

@media (max-width: 768px) {
  .error-code {
    font-size: 8rem;
  }
  .error-title {
    font-size: 1.5rem;
  }
  .error-actions {
    flex-direction: column;
    gap: 10px;
  }
}
</style>
